#include <map>
#include <string>
class Table:public std::map<std::string, int>
{
public:
    class Bad_op{};
    class Proxy
    {
    public:
        Proxy(Table& table, const std::string& str):_table(table),_str(str){}
        int& operator=(int data){
            std::map<std::string, int>* mp =
            static_cast<std::map<std::string, int>*>(&_table);
            mp->operator[](_str) = data;
        }
        operator int&()
        {
            if(_table.find(_str) == _table.end()){
                throw Bad_op();
            }            
            return _table[_str];
        }
        private:
            Table& _table;
            std::string _str;
    };
    Proxy operator[](const std::string& str)
    {
        return Proxy(*this, str);
    }
};


    
